-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Remove default content-length header from MultipartStreamBuilder class #63
Conversation
Some another library references : guzzle/psr7#581 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the RFC reference. yeah makes sense.
also boo microsoft for not being robust.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, will do the weird styleci thing. not related to your changes.
we should use the phpstan array format for this parameter actually... but out of scope for this pr
What's in this PR?
Remove default
Content-Length
header from MultipartStreamBuilder class.Why?
Content-Length
in multipart bodies is not necessary. Some legacies system can't manage the "Content-Length" header into "multipart/form-data" boundary and cut off the request.Currently I had face this problem with Azure OpenAI upload files API.
For reference see the RFC 7578 in section 4.8 which specify:
4.8. Other "Content-" Header Fields
The multipart/form-data media type does not support any MIME header
fields in parts other than Content-Type, Content-Disposition, and (in
limited circumstances) Content-Transfer-Encoding. Other header
fields MUST NOT be included and MUST be ignored.
Older system are not compliant because not apply the MUST be ignore policy but on the other side this code non apply the MUST NOT be included policy. So the Azure OpenAI API server is designed to be RFC compliant.
Example Usage
N/A
Checklist